#ifndef CLASS_GOAL_H
#define CLASS_GOAL_H

namespace spsu_art {

typedef enum { G_inactive, G_active, G_complete, G_failed } g_status;

class goal {
private:
    /*!@var Holds the status of this goal */
    g_status status;

    /*!@brief Returns wheather this is a composite goal or not */
    bool static is_composite();
protected:
    /*!@var A singleton that allows for communication with and checking the status
     * of the helecopter/autopilot.
     */
    autopilot helicopter;

    void set_status(g_status status);

public:
   /*!@brief Readies the goal to do its work.
    *
    * @return nothing
    *
    * This function must be overridden by all subclasses of goal.
    * Its job is to plan and ready itself to direct activity.
    */
   virtual void activate(); 

   /*!@brief Called for the goal to direct operation.
    *
    * @return One of the goal return values G_inactive,
    * G_active, G_complete or G_fail.
    *
    * This is the main function of the goal. It should moniter
    * progress toward its objective returning the state of its
    * objective G_inactive, G_active, G_complete or G_fail.
    */
   virtual g_status process(); 

   /*!@brief Called so the goal can clean itself up before deletion.
    *
    * @return nothing
    */
   virtual void terminate();

   /*!@brief This funtion should be overloaded to handle any messages receved.
    *
    * @return Wheather or not the message is handled
    * @param message A reference to the message structure sent
    *
    * The goal must handle the message if it is capable of it. If it cannot the
    * goal must return false. Then the goal sub-system  will pass the message
    * up the goal hierarchy until one is found that can handle it.
    */
   virtual bool handle_message(const Telegram& message);
   
   /*! Returns true if the goal is in active state. Should not be overridden. */ 
   bool is_active();

   /*! Returns true if the goal has not been activated, has failed or is complete. Should not be overridden. */
   bool is_inactive();

   /*! Returns true if the goal has failed. Should not be overridden. */
   bool has_failed();

   /*! Returns true if the goal has successfully completed. Should not be overridden. */
   bool is_complete();

   /*! Returns the status of the goal. Should not be overridden. */
   g_status get_status();
   
} //end class goal

} //end namespace goal

#endif
